import request from '@/axios/request';
import url from '@/axios/url';
const { mesUrl, adminUrl } = url();
// 导出url
export const exportUrl = `${mesUrl}mesScrapMaterial/export`
// 分页查询
export function getList(params = {}) {
  return request({
    url: `${mesUrl}mesScrapMaterial`,
    method: 'get',
    params,
  });
}
// 新增
export function rowCreate(data = {}) {
  return request({
    url: `${mesUrl}mesScrapMaterial`,
    method: 'post',
    data,
  });
}
// 修改
export function rowUpdate(data = {}) {
  return request({
    url: `${mesUrl}mesScrapMaterial`,
    method: 'put',
    data,
  });
}
// 删除
export function rowDel(id) {
  return request({
    url: `${mesUrl}mesScrapMaterial/${id}`,
    method: 'put',
  });
}
// 详情
export function rowDetail(id) {
  return request({
    url: `${mesUrl}mesScrapMaterial/info/${id}`,
    method: 'get',
  });
}

// 导入用户
export function importData (data = {}) {
  return request({
    url: `${mesUrl}mesScrapMaterial/import`,
    method: 'POST',
    data,
    headers: {
      'Content-Type': 'multipart/form-data',
    }
  })
}
// 下载模板
export const downloadTemplateUrl = `${mesUrl}mesScrapMaterial/template`

// 查询扫描类型0-批次；1-条码列表
export function getScanTypeList() {
  return request({
    url: `${adminUrl}dict/type/mes_scan_type`,
    method: 'get',
  });
}
// 查询物料类型 数据字典：成品、半成品、原材料列表
export function getGoodsTypeList() {
  return request({
    url: `${adminUrl}dict/type/material_type`,
    method: 'get',
  });
}
